<template>
  <div id="exchangeorder">  

    <el-form ref="form" :model="form" label-width="80px">  
     <el-row> 

        <el-col :span="20" style="display:flex;">

           <el-form-item label="" label-width="0px">
                <el-select  v-model="form.select_num" placeholder="请选择状态"  style="width:160px;">
                    <el-option  v-for="(item,index) in select_data" :key="index" :label="item.name" :value="item.id"></el-option>
                </el-select>
            </el-form-item>

          <el-form-item label="" label-width="0px" style="margin-left:10px;">
                 <el-date-picker type="date" @change="data_change" placeholder="选择日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd"  v-model="form.time"  style="width:160px;"></el-date-picker>
            </el-form-item>


            <el-form-item label-width="0px" style="margin-left:10px;">
               <el-input v-model="form.phone" placeholder="账户"  style="width:160px;"></el-input>
            </el-form-item>


           <div class="custom_button2"  style="margin-left:10px;" @click="search_but"></div>
        </el-col>

         <el-col :span="4" style="text-align: right;">  
            <el-button type="primary" class="custom_color_button" style="margin-bottom:10px;"  @click="refresh_but()">刷新</el-button>            
          </el-col>
    
    </el-row> 
   
   </el-form>
   <!-- 渲染数据list -->
   <exchangeorder-list :datalist="datalist"  @up_list_fun="list_fun"> </exchangeorder-list>

      
   <div style="margin-top:20px;text-align: center;">
      <el-pagination
        background
        @current-change="handleCurrentChange"
        :page-size="10"  
        layout="prev, pager, next, jumper"
        :total="count">
      </el-pagination>
    </div>

    

      
  </div>
</template>

<script>
import ExchangeorderList from '@/view/Exchangeorder/ExchangeorderList'
export default {
  name: 'exchangeorder',
  data () {
    return {
        datalist:[],
        page:1,
        count:0,
        form:{
          time:'',
          phone:'',
          select_num:''
        },
       select_data:[{"id":"wait_agree_seller","name":"等待确认"},{"id":"cancel_no_submit","name":"未上传凭证取消"},{"id":"cancel_no_finished","name":"未完成订单取消"},{"id":"wait_submit","name":"未上传凭证"},
          {"id":"submitted_first","name":"上传凭证"},{"id":"reject","name":"已驳回"},{"id":"submitted_second","name":"新上传"},{"id":"seller_appeal","name":"出让方申述"},
          {"id":"buyer_appeal","name":"兑换方申述"},{"id":"finish","name":"已完成"},{"id":"overtime","name":"超时自动完成"},{"id":"wait_admin","name":"申述待判定"},
          {"id":"seller_reason","name":"出兑方责任"},{"id":"buyer_reason","name":"兑换方责任"},{"id":"seller_mistake","name":"出让方确认申述"}
          ,{"id":"buyer_mistake","name":"兑换方确认申述"}],
    }
  },
 components:{
    ExchangeorderList
  },
  created(){
     //this.form.time = this.getNowDate1()
     this.list_fun()
  },
  mounted (){
    
  },
  methods: {
       list_fun(){
          this.post("/trade_kmb/listOfData", {
              page:this.page,
              onetime:this.form.time,
              telphone:this.form.phone,
              type:this.form.select_num
	        }).then(res => {
            this.count = res.result.count
            this.datalist = res.result.list

              for(let item of this.datalist) {

                // if(item.buy_type == 1){


                //       for(let a of item.qr_code) {
                //         if(a.collection_type == 1){
                //             item.srcListwx = a.collection_picture
                //             item.srcList1 = [this.urlimg + a.collection_picture]
                //         }else if(a.collection_type == 2){
                //             item.srcListzfb = a.collection_picture
                //             item.srcList2 = [this.urlimg + a.collection_picture]
                //         }else if(a.collection_type == 3){
                //             item.srcListysf = a.collection_picture
                //             item.srcList3 = [this.urlimg + a.collection_picture]
                //         }else if(a.collection_type == 4){
                //             item.srcListjh = a.collection_picture
                //             item.srcList4 = [this.urlimg + a.collection_picture]
                //         }else if(a.collection_type == 5){
                //             item.srcListyhk = a.collection_picture
                //             item.srcList5 = [this.urlimg + a.collection_picture]
                //         }

                //       }


                // }else if(item.buy_type == 2){
                  
                //      item.collection_pictureList = [this.urlimg + item.collection_picture]  //微信
                //      item.zfb_collection_pictureList = [this.urlimg + item.zfb_collection_picture]   //支付宝

                // }

               
                item.voucher_linkList = [this.urlimg + item.voucher_link]  //上传凭证

                item.reason_pictureList = [this.urlimg + item.reason_picture]  //原因凭证




              }

            console.log(res)
         })
      },
       search_but(){
        this.page = 1
        this.list_fun()
      },
      refresh_but(){
        this.page = 1
        this.form={
          time:'',
          phone:'',
          select_num:''
        }
        this.list_fun()
      },
       data_change(){
        console.log(this.form.time)
      },
      handleSizeChange(val) {
        console.log(`每页 ${val} 条`);
      },
      handleCurrentChange(val) {
        this.page = val
        this.list_fun()
        console.log(`当前页: ${val}`);
      }
  }
}
</script>


<style scoped>
</style>
